package com.itheima.model.audit.enums;

/**
 * 内容类型枚举
 */
public enum ContentType {
    
    /**
     * 笔记
     */
    NOTE("note", "笔记"),
    
    /**
     * 书评
     */
    REVIEW("review", "书评"),
    
    /**
     * 评论
     */
    COMMENT("comment", "评论"),
    
    /**
     * 用户头像
     */
    AVATAR("avatar", "用户头像"),
    
    /**
     * 用户昵称
     */
    NICKNAME("nickname", "用户昵称");

    private final String code;
    private final String desc;

    ContentType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static ContentType fromCode(String code) {
        for (ContentType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }
}


